﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;

namespace Data {
    public class BaoCaoTonRepository {
        public DataTable BaoCaoTon(int thang, int nam) {
            DataTable table = new DataTable();
            QuanLyNhaSachEntities context = new QuanLyNhaSachEntities();
            var query = from s in context.BaoCaoTon(5, 2011)
                        select new {
                            s.MaSach,
                            s.TenSach
                        };

            table.Columns.Add("MaSach");
            table.Columns.Add("TenSach");

            foreach (var item in query) {
                DataRow r = table.NewRow();
                r["MaSach"] = item.MaSach;
                r["TenSach"] = item.TenSach;
                table.Rows.Add(r);
            }
            return table;
        }

    }
}
